import React, {useEffect, useState} from 'react';
import '@/views/NotFount/notFount.css'
import {Button} from "antd";

const NotFount = () => {
    let [second, setSecond] = useState(5)
    let timer
    useEffect(() => {
        timer = setInterval(() => {
            if (second === 0) {
                clearInterval(timer)
                window.history.back()
            } else {
                setSecond(second - 1)
            }
        }, 1000)
        return () => clearInterval(timer);
    }, [second]);
    return (
        <div className="error">
            <div className='error-text'>
                <div className="error-code">404</div>
                <div className="error-title">页面不存在</div>
                <Button onClick={() => {
                    window.history.back()
                }}>{second}秒后返回上一页</Button>
            </div>
        </div>
    )
};

export default NotFount;